#ifndef MUSIC_H
#define MUSIC_H

#include <QWidget>
#include<QPainter>
#include<QNetworkReply>
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonArray>
#include <QStandardItemModel>
#include <QDebug>
#include <QNetworkAccessManager>
#include <QJsonDocument>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include<QTableView>
#include <QObject>
#include<QMediaPlaylist>
#include<QMediaPlayer>
#include <QSlider>
#include <QLabel>
#include <QTimer>
#include <QVBoxLayout>


namespace Ui {
class music;
}

class music : public QWidget
{
    Q_OBJECT

public:
    explicit music(QWidget *parent = nullptr);
    ~music();
    void paintEvent(QPaintEvent *event);
    void scrollLyric();

public slots:
    void replyFinished(QNetworkReply *reply);
    void parseJson(QByteArray byteArray);
    void durationChangedSlot(qint64 duration);
    void positionChangedSlot(qint64 position);
    void on_horizontalSlider_sliderReleased();
    void getLyric(QByteArray byteArray);
private slots:
    void on_pushButton_clicked();

    void on_tableView_doubleClicked(const QModelIndex &index);

    void on_pushButton_3_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

    void on_verticalSlider_valueChanged(int value);

private:
    Ui::music *ui;
    QStandardItemModel *pmodel;
    QNetworkAccessManager *manager;
    QMediaPlaylist *playlist;
    QMediaPlayer *player;
    QSlider *volumeSlider;
    QTimer *lyricTimer; // 声明歌词滚动定时器
    QLabel *lyricLabel; // 声明歌词Label
    QStringList lyrics; // 声明歌词字符串列表
};

#endif // MUSIC_H
